package com.example.demo.dao;

import com.example.demo.demos.CircleLike;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface CircleLikeDao extends JpaRepository<CircleLike,Integer> {
    List<CircleLike> findByCircleIdAndUserId(int circleId, int userId);
    @Query(value = "select count(id) from circle_like where user_id = ?1",nativeQuery = true)
    int getCountMyLike(int userId);
    @Query(value = "select GROUP_CONCAT(nickname) from user where id in " +
            "(select user_id from circle_like where circle_id=?1 and status=1)",nativeQuery = true)
    String getLikeUsers(int id);
}
